import useRequest from "@/utils/request";

const request = useRequest({});
/**
 * 新增/修改场馆企业认证信息
 * @param {Object} entity 场馆实体对象
 * @returns {Promise} 请求的 Promise 对象
 */
export function createStadium(entity: any) {
  return request.post("/cj-stadium/sys/stadium/stadium/create", entity);
}

/**
 * 完善场馆基本信息（场地、价格）
 * @param {Object} entity 场馆实体对象
 * @returns {Promise} 请求的 Promise 对象
 */
export function updateStadium(entity: any) {
  return request.post("/cj-stadium/sys/stadium/stadium/updateStadium", entity);
}

/**
 * 获取场馆列表
 * @param {Object} params 查询参数
 * @returns {Promise} 请求的 Promise 对象
 */
export function listStadium(params: any) {
  return request.get("/cj-stadium/sys/stadium/stadium/list", {
    params,
  });
}

/**
 * 获取场馆审核列表
 * @param {Object} params 查询参数
 * @returns {Promise} 请求的 Promise 对象
 */
export function listApprovalStadium(params: any) {
  return request.get("/cj-stadium/sys/stadium/stadium/getApprovalList", {
    params,
  });
}

/**
 * 删除场馆
 * @param {number} id 场馆ID
 * @returns {Promise} 请求的 Promise 对象
 */
export function delStadium(id: string | number) {
  return request.get(`/cj-stadium/sys/stadium/stadium/delStadium/${id}`);
}

/**
 * 停/启 用场馆
 * @param {number} id 场馆 ID
 * @param {number} enable 启用状态，1 启用；0 停用
 * @returns {Promise} 请求的 Promise 对象
 */
export function editEnable(id: string | number, enable: string | number) {
  return request.get(`/cj-stadium/sys/stadium/stadium/editStadiumEnable/${id}`, {
    params: {
      enable,
    },
  });
}

// 场馆基础信息查询
export function getStadium(id: string | number) {
  return request.get(`/cj-stadium/sys/stadium/base/entity/get/${id}`);
}

// 场馆服务查询 根据ByStadiumId
export function getService(id: string | number) {
  return request.get(`/cj-stadium/sys/stadium/base/service/getByStadiumId/${id}`);
}

// 站点文件查询 ByStadiumId
export function getFile(id: string | number) {
  return request.get(`/cj-stadium/sys/stadium/base/file/getByStadiumId/${id}`);
}

// 根据Id 删除场馆照片
export function deleteFile(id: string | number) {
  return request.get(`/cj-stadium/sys/stadium/base/file/delete/${id}`);
}

// 新增场馆 图片
export function createFile(entity: any) {
  return request.post("/cj-stadium/sys/stadium/base/file/create", entity);
}

// Id 删除场馆服务
export function deleteService(id: string | number) {
  return request.get(`/cj-stadium/sys/stadium/base/service/delete/${id}`);
}

/**
 * 查询地址树状图
 * @returns {Promise} 请求的 Promise 对象
 */
export function getAreaTree() {
  return request.get("/system/area/getTree");
}

//审批通过
export function approveStadium(id: string | number) {
  return request.get(`/cj-stadium/sys/stadium/stadium/approve`, {
    params: { id },
  });
}

//审批驳回
export function rejectStadium(params: any) {
  return request.get(`/cj-stadium/sys/stadium/stadium/reject`, {
    params,
  });
}

//审批驳回
export function getStadiumServiceList(params: any) {
  return request.get(`/cj-stadium/sys/stadium/getStadiumServiceList`, {
    params,
  });
}

//场馆名称查询
export function getStadiumName(params: any) {
  return request.get(`/cj-stadium/sys/stadium/getStadiumDataByName`, {
    params,
  });
}
//场馆-获取企业认证信息-暂存信息
export function getEnterpriseData(params: any) {
  return request.get(`/cj-stadium/sys/stadium/stadium/getEnterpriseData`, {
    params,
  });
}

//场馆-统计启用停用数量
export function countStadiumEnable(params: any) {
  return request.get(`/cj-stadium/sys/stadium/countStadiumEnable`, {
    params,
  });
}

//查找单条场馆的信息 根据id
export function getStadiumById(id: string | number) {
  return request.get(`/cj-stadium/sys/stadium/stadium/getStadiumById`, {
    params: { id },
  });
}

// 场馆-详情内场地看板
export function getBulletinListByStadiumId(data: any) {
  return request.post(`/cj-stadium/sys/stadium/getBulletinListByStadiumId`, data);
}

//场馆-数据概况
export function getDataProfiling(params: any) {
  return request.get(`/cj-stadium/sys/stadium/getDataProfiling`, {
    params,
  });
}

//场馆-预约信息
export function getOrderListByStadiumId(params: any) {
  return request.get(`/cj-stadium/sys/stadium/getOrderListByStadiumId`, {
    params,
  });
}

//场馆-评论留言
export function getEvaluateListByStadiumId(params: any) {
  return request.get(`/cj-stadium/sys/stadium/getEvaluateListByStadiumId`, {
    params,
  });
}

//根据id删除评价
export function delEvaluateById(id: string | number) {
  return request.post(`/cj-stadium/sys/evaluate/delEvaluateById/${id}`);
}

//根据id隐藏评价
export function updateEvaluateStatus(params: any) {
  return request.get(`/cj-stadium/sys/evaluate/updateEvaluateStatus`, {
    params,
  });
}

//根据场馆id获取场地列表
export function getSiteListByStadiumId(params: any) {
  return request.get(`/cj-stadium/sys/site/getSiteListByStadiumId`, {
    params,
  });
}

//场地-修改场地信息及其价格
export function updateSiteListAndPrice(data: any) {
  return request.post(`/cj-stadium/sys/site/updateSiteListAndPrice`, data);
}

//根据场次id查询订单信息
export function getOrderDataByBulletinId(params: any) {
  return request.get(`/cj-stadium/sys/bulletin/getOrderDataByBulletinId`, {
    params,
  });
}

//根据场次id启停场次
export function disableBulletin(params: any) {
  return request.get(`/cj-stadium/sys/bulletin/disableBulletin`, {
    params,
  });
}
//批量锁定场次
export function disableBulletinList(data: any) {
  return request.post(`/cj-stadium/sys/bulletin/disableBulletinList`, data);
}
//批量解锁场次
export function enableBulletinList(data: any) {
  return request.post(`/cj-stadium/sys/bulletin/enableBulletinList`, data);
}

//pc操作用户换场
export function updateBulletin(params: any) {
  return request.get(`/cj-stadium/sys/bulletin/updateBulletin`, {
    params,
  });
}

//场馆-统计审核各状态数量
export function countStadiumApproval(params: any) {
  return request.get(`/cj-stadium/sys/stadium/countStadiumApproval`, {
    params,
  });
}
/**
 * 获取场馆列表无分页
 * @param {Object} params 查询参数
 * @returns {Promise} 请求的 Promise 对象
 */
export function getStadiumInfo(params: any) {
  return request.get("/cj-stadium/sys/stadium/getStadiumInfo", {
    params,
  });
}

//场馆-根据企业营业执照注册号查询企业认证信息
export function getEnterpriseDataByNum(params: any) {
  return request.get(`/cj-stadium/sys/stadium/stadium/getEnterpriseDataByNum`, {
    params,
  });
}

// 价格模版列表
export function getTemplateList(params: any) {
  return request.get("/cj-stadium/sys/bulletin/getTemplateList", {
    params,
  });
}

// 价格模版创建
export function createBulletinTemplate(data: any) {
  return request.post("/cj-stadium/sys/bulletin/createBulletinTemplate", data);
}

// 价格模版删除
export function deleteTemplate(templateId: string | number) {
  return request.get("/cj-stadium/sys/bulletin/deleteTemplate", {
    params: {
      templateId,
    },
  });
}

// 价格模版应用
export function applyTemplate(params: any) {
  return request.get("/cj-stadium/sys/bulletin/applyTemplate", {
    params,
  });
}

// 场馆基本信息编辑
export function settingStadiumInfo(data: any) {
  return request.post("/cj-stadium/sys/stadiumAndSite/stadium/settingStadiumInfo", data);
}

// 场馆信息提交审核
export function submitStadiumApproval(params: any) {
  return request.get("/cj-stadium/sys/stadiumAndSite/stadium/submitStadiumApproval", {
    params,
  });
}

// 场馆审批记录列表
export function getStadiumApprovalList(id: string | number) {
  return request.get("/cj-stadium/sys/stadiumAndSite/stadium/getStadiumApprovalList", {
    params: {
      stadiumId: id,
    },
  });
}

// 场馆-根据场馆id查询场馆审批数据
export function getStadiumApprovalData(id: string | number) {
  return request.get("/cj-stadium/sys/stadium/approval/getStadiumApprovalData", {
    params: {
      stadiumId: id,
    },
  });
}

// 场馆-场馆审核信息删除
export function delStadiumApproval(id: string | number) {
  return request.get("/cj-stadium/sys/stadium/approval/stadium/delStadiumApproval", {
    params: {
      stadiumId: id,
    },
  });
}